/**
    打印给定范围内的质数
 */

public class PrimeNumber {
    public static void main(String[] args) {

        boolean isFlag;
//        获取当前时间距离 1970-01-01 00:00:00 的毫秒数
        long start = System.currentTimeMillis();

        for (int i = 2; i <= 100000; i++) {
            isFlag = true;
            for (int j = 2; j < Math.sqrt(i); j++) {
                if(i % j ==0){
                    isFlag = false;
                    break;
                }
            }
            if(isFlag == true){
                System.out.println(i);
            }
        }
        long end = System.currentTimeMillis();
        long totalTime = end - start;
        System.out.println("totalTime: " + totalTime);
    }
}
